package com.reservationserver.mapper.admin;

import com.reservationpojo.domin.vo.AdminBadmintonvo;
import com.reservationpojo.entity.Badminton;
import com.reservationpojo.entity.shutdowncourt;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AdminBadmintonMapper {
    //管理员查询全部的预约信息
    List<Badminton> selectreservation(AdminBadmintonvo badminton);

    //取消指定预约记录
    @Update("update badminton set status=#{status} where reservation_start_time=#{reservationStartTime} and " +
            "reservation_end_time=#{reservationEndTime} and position=#{position} and reserved_byid=#{reservedByid} and create_time=#{createTime} ")
    void deleteReservation(Badminton badminton);
    //签到入场
    @Update("update badminton set status = #{status} where reservation_start_time=#{reservationStartTime} and " +
            "reservation_end_time=#{reservationEndTime} and position=#{position} and reserved_byid=#{reservedByid} and create_time=#{createTime}")
    Badminton checkReservation(Badminton badminton);
    //关闭场地
    @Insert("insert into shutdowncourt (court,start_time) values (#{courtId},#{starttime})")
    void shutDownCourt(String courtId, LocalDateTime starttime);
    @Delete("delete from shutdowncourt where court=#{courtId}")
    void openCourt(String courtId);
    @Select("select court from shutdowncourt where court like concat('badminton','%')")
    List<shutdowncourt> checkCourt();
    @Insert("insert into isrepeate (badminton, pingpong) values (0,0)")
    void inrepeate();
    @Update("update isrepeate set badminton =1 where flag= '1'")
    void uprepeate();
    @Select("select badminton,pingpong from isrepeate where flag=1")
    List<Boolean> serepeate();
}
